/* USER CODE BEGIN Header */
/**
  ******************************************************************************
  * @file           : main.h
  * @brief          : Header for main.c file.
  *                   This file contains the common defines of the application.
  ******************************************************************************
  * @attention
  *
  * Copyright (c) [2021] [Fudan Microelectronics]
  * THIS SOFTWARE is licensed under Mulan PSL v2.
  * can use this software according to the terms and conditions of the Mulan PSL v2.
  * You may obtain a copy of Mulan PSL v2 at:
  *          http://license.coscl.org.cn/MulanPSL2
  * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  * See the Mulan PSL v2 for more details.
  *
  ******************************************************************************
  */
/* USER CODE END Header */

/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef _MAIN_H_
#define _MAIN_H_

/* Includes ------------------------------------------------------------------*/
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "mf_config.h"
#include "project.h"

/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */

/* USER CODE END Includes */

/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */

/* USER CODE END ET */

/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */

/* USER CODE END EC */

/* Exported variables ---------------------------------------------------------*/
/* USER CODE BEGIN EV */
extern uint16_t guiSysFlag;
/* USER CODE END EV */

/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
#define BIT0                                                             ((uint16_t)(0x0001))
#define BIT1                                                             ((uint16_t)(0x0002))
#define BIT2                                                             ((uint16_t)(0x0004))
#define BIT3                                                             ((uint16_t)(0x0008))
#define BIT4                                                             ((uint16_t)(0x0010))
#define BIT5                                                             ((uint16_t)(0x0020))
#define BIT6                                                             ((uint16_t)(0x0040))
#define BIT7                                                             ((uint16_t)(0x0080))
#define BIT8                                                             ((uint16_t)(0x0100))
#define BIT9                                                             ((uint16_t)(0x0200))
#define BIT10                                                            ((uint16_t)(0x0400))
#define BIT11                                                            ((uint16_t)(0x0800))
#define BIT12                                                            ((uint16_t)(0x1000))
#define BIT13                                                            ((uint16_t)(0x2000))
#define BIT14                                                            ((uint16_t)(0x4000))
#define BIT15                                                            ((uint16_t)(0x8000))

// flags
// uart0
#define GET_UART0_HART_RX_START_FLG()                                    (guiSysFlag & BIT0)
#define SET_UART0_HART_RX_START_FLG()                                    (guiSysFlag |= BIT0)
#define CLR_UART0_HART_RX_START_FLG()                                    (guiSysFlag &= ~BIT0)

#define GET_UART0_HART_RX_FINISHED_FLG()                                 (guiSysFlag & BIT1)
#define SET_UART0_HART_RX_FINISHED_FLG()                                 (guiSysFlag |= BIT1)
#define CLR_UART0_HART_RX_FINISHED_FLG()                                 (guiSysFlag &= ~BIT1)
// uart4
#define GET_UART4_RX_START_FLG()                                         (guiSysFlag & BIT2)
#define SET_UART4_RX_START_FLG()                                         (guiSysFlag |= BIT2)
#define CLR_UART4_RX_START_FLG()                                         (guiSysFlag &= ~BIT2)

#define GET_UART4_RX_FINISHED_FLG()                                      (guiSysFlag & BIT3)
#define SET_UART4_RX_FINISHED_FLG()                                      (guiSysFlag |= BIT3)
#define CLR_UART4_RX_FINISHED_FLG()                                      (guiSysFlag &= ~BIT3)

#define UART_RX_BUFFER_SIZE                                              (16)
#define HART_RX_BUFFER_SIZE                                              (64)
/* USER CODE END EM */

/* Exported functions prototypes ---------------------------------------------*/
/* USER CODE BEGIN EFP */

/* USER CODE END EFP */

/* Private defines -----------------------------------------------------------*/
/* USER CODE BEGIN Private defines */

/* USER CODE END Private defines */

#endif /* __MAIN_H */
